function del_confirm(info) {
	var msg = "您真的确定要删除吗？\n\n请确认！";
	if(info){
		msg = info +"\n\n请确认！";
	}
	if (confirm(msg) == true) {
		return true;
	} else {
		return false;
	}
}

String.prototype.Trim = function() 
{ 
	return this.replace(/(^\s*)|(\s*$)/g, ""); 
}

String.prototype.LTrim = function() 
{ 
	return this.replace(/(^\s*)/g, ""); 
}

String.prototype.RTrim = function() 
{ 
	return this.replace(/(\s*$)/g, ""); 
}

String.prototype.CountCharacters = function(){
	var totalCount = 0; 
    for(var i=0; i<this.length; i++){ 
        var c = this.charCodeAt(i); 
        if ((c >= 0x0001 && c <= 0x007e) || (0xff60<=c && c<=0xff9f)){ 
             totalCount++; 
        } 
        else{      
            totalCount+=2; 
        } 
     } 
    return totalCount; 
}

String.prototype.replaceAll  = function(s1,s2){   
	return this.replace(new RegExp(s1,"gm"),s2);   
} 

String.prototype.IsEmail = function(){
	var p = /[_a-zA-Z\d\-\.]+@[_a-zA-Z\d\-]+(\.[_a-zA-Z\d\-]+)+$/;
	if (!p.test(this)) {
		return false;
	}
	return true;
}

Array.prototype.indexOf= function(value){
	for(var i=0,l=this.length;i<l;i++)if(this[i]==value)return i;return -1;
}

String.prototype.IsMobile = function(){
	return /^0{0,1}1[3,4,5,7,8][0-9]{9}$/.test(this);
};

function prompt(msg){
	$(".show_public_tips").html(msg);
	$(".show_public_tips").stop(true, true).fadeIn(500).delay(1500).fadeOut(500);
}

function getCookie(name) {
    var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
    if (arr != null) return JSON.parse(unescape(arr[2])); return null;
}

function setCookie(name, value) {
    var Days = 180; //此 cookie 将被保存 30 天
    var exp = new Date();    //new Date("December 31, 9998");
    exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
    document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString();
}

var cookieName ="tips_help";

function showTipsHelp(){
	var val = getCookie(cookieName);
	if(val==null){
		$("#tips_help").fadeIn(400);
	}
}

$(function () {
	showTipsHelp();
	$("#close_help").click(function(){
		$("#tips_help").hide();
		setCookie(cookieName,1);
	});
	
	$("#top_arrow").hide();
	
    $(window).scroll(function(){
        if ($(window).scrollTop()>100){
            $("#top_arrow").fadeIn(400);
        }
        else
        {
            $("#top_arrow").fadeOut(400);
        }
    });
});